#pragma once
#include "dataTypes.h"
#include "ObjectProperty.h"
#include "ObjectId.h"

/*! 
 * Combo controller property.
 */
class ComboControllerProperty: public ObjectProperty
{
public:
	static const StringHash COMBO_CONTROLLER_PROPERTY_ID;

	ComboControllerProperty(const ObjectId& objectId, char key1, char key2, real maxTime);
	~ComboControllerProperty();

	/*! 
	 * First key for execute the special shot.
	 */
	char getKey1() const;
	/*! 
	 * Second key for execute the special shot.
	 */
	char getKey2() const;

	/*! 
	 * Return true if the combo is in progress.
	 *
	 * \note A combo is 'in progress' when the player has pressed the first key (and the timer has not exceeded the max time).
	 */
	bool inProgress() const;
	/*! 
	 * Return true if the combo is completed.
	 *
	 * \note A combo is completed when the player has pressed the first and (after) the second one (and the timer has not exceeded the max time).
	 */
	bool isCompleted() const;

	/*!
	 * Set the combo as 'in progress' and reset the timer.
	 */
	void startCombo();

	/*! 
	 * Stop the combo (reset its state).
	 */
	void stopCombo();

	/*! 
	 * Set the combo as completed.
	 */
	void completeCombo();

	/*! 
	 * Update the timer. If the time is greater than the max allowed time, the combo will be stopped. 
	 */
	void updateTimer(const real elapsedTime);
	/*!
	 * Reset combo's timer.
	 */
	void resetTimer();

private:
	char	m_key1;
	char	m_key2;

	bool	m_inProgress;
	bool	m_completed;

	real	m_maxTime;
	real 	m_executionTimer;
};